﻿@model IEnumerable<CSF.Security.Data.UserActionLog>
@{
    ViewBag.Title = "Index";
    ViewBag.SubTitle = "User Action Log";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div id="applicationPanel" class="easyui-panel" title="Grid" icon="icon-save" collapsible="true"
    style="width: auto; padding: 10px; background: #fafafa;">
    @using (Html.BeginForm("UserActionLog", "UserLog", FormMethod.Get))
    { 
        @Html.Hidden("SessionId", Request["SessionId"])
        <div style="text-align: right">
            &nbsp;&nbsp;User Name:<input id="UserName" name="UserName" />
            <a href="javascript:submitSearch();" class="easyui-linkbutton" iconcls="icon-search"
                plain="true">Search</a>
            <input id="search" type="submit" value="submit" style="display: none" />
        </div>    
        @Html.Hidden("toUrl", Request.Url.ToString())
        <div id="grid">
            @{  var grid = new WebGrid(source: Model, defaultSort: "UserName", rowsPerPage: 15, ajaxUpdateContainerId: "grid");    
                @grid.GetHtml(
                               tableStyle: "webGrid",
                               headerStyle: "header",
                               alternatingRowStyle: "alt",
                               footerStyle: "foot",
                                columns: grid.Columns(
                                                       grid.Column("SessionId", "SessionId"),
                                                        grid.Column("UserName", "UserName"),
                                                        grid.Column("ActionTime", "ActionTime"),
                                                        grid.Column("Method", "Method"),
                                                        grid.Column("QueryString", "QueryString"),
                                                        grid.Column("Path", "Path")

                                            ),
                                                                                fillEmptyRows: !IsPost,
                                                                                mode: WebGridPagerModes.All,
                                                                                firstText: "First Page",
                                                                                previousText: "Previous Page",
                                                                                nextText: "Next Page",
                                                                                lastText: "Last Page",
                                                                                numericLinksCount: 15
                                                                          ) 
            }
        </div>
    }
</div>
<script type="text/javascript">
    function submitSearch() {
        $('#search').click();
    }
</script>
